using System.Collections.Generic;
namespace mock_ehr_lib.Data.LookupServices
{
    public class LookupServiceFactory
    {
        private static string ICD9LookupServiceCode = "";
        private static string CPTLookupServiceCode = "";
        private static string FDBLookupServiceCode = "";

        // this will hold all instances
        private static readonly Dictionary<string, ILookupService> _lookupServices;

        static LookupServiceFactory()
        {
            _lookupServices = new Dictionary<string, ILookupService>();
        }

        /// <summary>
        /// Get a lookup service based on the code represented in CCD/CCR
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public static ILookupService GetLookupServiceByCodeSystem(string code)
        {
            ILookupService result = null;
            if(!_lookupServices.ContainsKey(code))
            {
                switch (code)
                {
                    case "2.16.840.1.113883.6.96":  // SNOMED
                        result = SNOMEDLookupService.Instance;
                        break;
                    case "2.16.840.1.113883.6.1":   // LOINC
                        result = LOINCLookupService.Instance;
                        break;
                    case "2.16.840.1.113883.6.88":  // RxNorm
                        result = RxNormLookupService.Instance;
                        break;
                    case "2.16.840.1.113883.5.4":   // IMMUNIZ (HL7)
                    case "2.16.840.1.113883.5.111": // ROLECODE (HL7)
                    case "2.16.840.1.113883.5.1":   // HITSP-CS-1 (HL7)
                    default:
                        break;
                }
            }
            return result;
        }
    }
}